
/**
* 页面跳转
*/
export function navigate(url) {
  wx.navigateTo({ url: url });
}

/**
* 返回上一页
*/
export function goBack() {
  wx.navigateBack({ delta: 1 })
}



export function formatImgStr(str) {
  const newStr = str.substr(0, str.length - 1)
  return newStr
}

export function toast(text, type, callback) {
  if (type === 'success') {
    wx.showToast({
      title: text,
      icon: 'success',
      mask: true,
      duration: 2000, //延迟时间,
    })
  } else if (type === 'loading') {
    wx.showToast({
      title: text,
      icon: 'loading',
      duration: 2000, //延迟时间,
    })
  } else {
    wx.showToast({
      title: text,
      icon: 'none',
      duration: 2000, //延迟时间,
    })
  }
  if (callback) {
    setTimeout(function () {
      callback()
    }, 1000)
  }
}